<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Covariance (Commons Math 3.2 API)
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="Covariance (Commons Math 3.2 API)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Covariance.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html" title="class in org.apache.commons.math3.stat.correlation"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../../index.html?org/apache/commons/math3/stat/correlation/Covariance.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Covariance.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.commons.math3.stat.correlation</FONT>
<BR>
Class Covariance</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
  <IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.commons.math3.stat.correlation.Covariance</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/StorelessCovariance.html" title="class in org.apache.commons.math3.stat.correlation">StorelessCovariance</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>Covariance</B><DT>extends <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>

<P>
Computes covariances for pairs of arrays or columns of a matrix.

 <p>The constructors that take <code>RealMatrix</code> or
 <code>double[][]</code> arguments generate covariance matrices.  The
 columns of the input matrices are assumed to represent variable values.</p>

 <p>The constructor argument <code>biasCorrected</code> determines whether or
 not computed covariances are bias-corrected.</p>

 <p>Unbiased covariances are given by the formula</p>
 <code>cov(X, Y) = &Sigma;[(x<sub>i</sub> - E(X))(y<sub>i</sub> - E(Y))] / (n - 1)</code>
 where <code>E(X)</code> is the mean of <code>X</code> and <code>E(Y)</code>
 is the mean of the <code>Y</code> values.

 <p>Non-bias-corrected estimates use <code>n</code> in place of <code>n - 1</code>
<P>

<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>2.0</DD>
<DT><B>Version:</B></DT>
  <DD>$Id: Covariance.java 1453271 2013-03-06 10:29:51Z luc $</DD>
</DL>
<HR>

<P>

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#Covariance()">Covariance</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a Covariance with no data</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#Covariance(double[][])">Covariance</A></B>(double[][]&nbsp;data)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a Covariance matrix from a rectangular array
 whose columns represent covariates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#Covariance(double[][], boolean)">Covariance</A></B>(double[][]&nbsp;data,
           boolean&nbsp;biasCorrected)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a Covariance matrix from a rectangular array
 whose columns represent covariates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#Covariance(org.apache.commons.math3.linear.RealMatrix)">Covariance</A></B>(<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A>&nbsp;matrix)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a covariance matrix from a matrix whose columns
 represent covariates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#Covariance(org.apache.commons.math3.linear.RealMatrix, boolean)">Covariance</A></B>(<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A>&nbsp;matrix,
           boolean&nbsp;biasCorrected)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a covariance matrix from a matrix whose columns
 represent covariates.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#computeCovarianceMatrix(double[][])">computeCovarianceMatrix</A></B>(double[][]&nbsp;data)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a covariance matrix from a rectangular array whose columns represent
 covariates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#computeCovarianceMatrix(double[][], boolean)">computeCovarianceMatrix</A></B>(double[][]&nbsp;data,
                        boolean&nbsp;biasCorrected)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compute a covariance matrix from a rectangular array whose columns represent
 covariates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#computeCovarianceMatrix(org.apache.commons.math3.linear.RealMatrix)">computeCovarianceMatrix</A></B>(<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A>&nbsp;matrix)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a covariance matrix from a matrix whose columns represent
 covariates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#computeCovarianceMatrix(org.apache.commons.math3.linear.RealMatrix, boolean)">computeCovarianceMatrix</A></B>(<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A>&nbsp;matrix,
                        boolean&nbsp;biasCorrected)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compute a covariance matrix from a matrix whose columns represent
 covariates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#covariance(double[], double[])">covariance</A></B>(double[]&nbsp;xArray,
           double[]&nbsp;yArray)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computes the covariance between the two arrays, using the bias-corrected
 formula.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#covariance(double[], double[], boolean)">covariance</A></B>(double[]&nbsp;xArray,
           double[]&nbsp;yArray,
           boolean&nbsp;biasCorrected)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computes the covariance between the two arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#getCovarianceMatrix()">getCovarianceMatrix</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the covariance matrix</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#getN()">getN</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of observations (length of covariate vectors)</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="Covariance()"><!-- --></A><H3>
Covariance</H3>
<PRE>
public <B>Covariance</B>()</PRE>
<DL>
<DD>Create a Covariance with no data
<P>
</DL>
<HR>

<A NAME="Covariance(double[][], boolean)"><!-- --></A><H3>
Covariance</H3>
<PRE>
public <B>Covariance</B>(double[][]&nbsp;data,
                  boolean&nbsp;biasCorrected)
           throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A>,
                  <A HREF="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</A></PRE>
<DL>
<DD>Create a Covariance matrix from a rectangular array
 whose columns represent covariates.

 <p>The <code>biasCorrected</code> parameter determines whether or not
 covariance estimates are bias-corrected.</p>

 <p>The input array must be rectangular with at least one column
 and two rows.</p>
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - rectangular array with columns representing covariates<DD><CODE>biasCorrected</CODE> - true means covariances are bias-corrected
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the input data array is not
 rectangular with at least two rows and one column.
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</A></CODE> - if the input data array is not
 rectangular with at least one row and one column.</DL>
</DL>
<HR>

<A NAME="Covariance(double[][])"><!-- --></A><H3>
Covariance</H3>
<PRE>
public <B>Covariance</B>(double[][]&nbsp;data)
           throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A>,
                  <A HREF="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</A></PRE>
<DL>
<DD>Create a Covariance matrix from a rectangular array
 whose columns represent covariates.

 <p>The input array must be rectangular with at least one column
 and two rows</p>
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - rectangular array with columns representing covariates
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the input data array is not
 rectangular with at least two rows and one column.
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</A></CODE> - if the input data array is not
 rectangular with at least one row and one column.</DL>
</DL>
<HR>

<A NAME="Covariance(org.apache.commons.math3.linear.RealMatrix, boolean)"><!-- --></A><H3>
Covariance</H3>
<PRE>
public <B>Covariance</B>(<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A>&nbsp;matrix,
                  boolean&nbsp;biasCorrected)
           throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></PRE>
<DL>
<DD>Create a covariance matrix from a matrix whose columns
 represent covariates.

 <p>The <code>biasCorrected</code> parameter determines whether or not
 covariance estimates are bias-corrected.</p>

 <p>The matrix must have at least one column and two rows</p>
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>matrix</CODE> - matrix with columns representing covariates<DD><CODE>biasCorrected</CODE> - true means covariances are bias-corrected
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the input matrix does not have
 at least two rows and one column</DL>
</DL>
<HR>

<A NAME="Covariance(org.apache.commons.math3.linear.RealMatrix)"><!-- --></A><H3>
Covariance</H3>
<PRE>
public <B>Covariance</B>(<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A>&nbsp;matrix)
           throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></PRE>
<DL>
<DD>Create a covariance matrix from a matrix whose columns
 represent covariates.

 <p>The matrix must have at least one column and two rows</p>
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>matrix</CODE> - matrix with columns representing covariates
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the input matrix does not have
 at least two rows and one column</DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="getCovarianceMatrix()"><!-- --></A><H3>
getCovarianceMatrix</H3>
<PRE>
public <A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A> <B>getCovarianceMatrix</B>()</PRE>
<DL>
<DD>Returns the covariance matrix
<P>
<DD><DL>

<DT><B>Returns:</B><DD>covariance matrix</DL>
</DD>
</DL>
<HR>

<A NAME="getN()"><!-- --></A><H3>
getN</H3>
<PRE>
public int <B>getN</B>()</PRE>
<DL>
<DD>Returns the number of observations (length of covariate vectors)
<P>
<DD><DL>

<DT><B>Returns:</B><DD>number of observations</DL>
</DD>
</DL>
<HR>

<A NAME="computeCovarianceMatrix(org.apache.commons.math3.linear.RealMatrix, boolean)"><!-- --></A><H3>
computeCovarianceMatrix</H3>
<PRE>
protected <A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A> <B>computeCovarianceMatrix</B>(<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A>&nbsp;matrix,
                                             boolean&nbsp;biasCorrected)
                                      throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></PRE>
<DL>
<DD>Compute a covariance matrix from a matrix whose columns represent
 covariates.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>matrix</CODE> - input matrix (must have at least one column and two rows)<DD><CODE>biasCorrected</CODE> - determines whether or not covariance estimates are bias-corrected
<DT><B>Returns:</B><DD>covariance matrix
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the matrix does not contain sufficient data</DL>
</DD>
</DL>
<HR>

<A NAME="computeCovarianceMatrix(org.apache.commons.math3.linear.RealMatrix)"><!-- --></A><H3>
computeCovarianceMatrix</H3>
<PRE>
protected <A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A> <B>computeCovarianceMatrix</B>(<A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A>&nbsp;matrix)
                                      throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></PRE>
<DL>
<DD>Create a covariance matrix from a matrix whose columns represent
 covariates. Covariances are computed using the bias-corrected formula.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>matrix</CODE> - input matrix (must have at least one column and two rows)
<DT><B>Returns:</B><DD>covariance matrix
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if matrix does not contain sufficient data<DT><B>See Also:</B><DD><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#Covariance(org.apache.commons.math3.linear.RealMatrix)"><CODE>Covariance(org.apache.commons.math3.linear.RealMatrix)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="computeCovarianceMatrix(double[][], boolean)"><!-- --></A><H3>
computeCovarianceMatrix</H3>
<PRE>
protected <A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A> <B>computeCovarianceMatrix</B>(double[][]&nbsp;data,
                                             boolean&nbsp;biasCorrected)
                                      throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A>,
                                             <A HREF="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</A></PRE>
<DL>
<DD>Compute a covariance matrix from a rectangular array whose columns represent
 covariates.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - input array (must have at least one column and two rows)<DD><CODE>biasCorrected</CODE> - determines whether or not covariance estimates are bias-corrected
<DT><B>Returns:</B><DD>covariance matrix
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the data array does not contain sufficient
 data
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</A></CODE> - if the input data array is not
 rectangular with at least one row and one column.</DL>
</DD>
</DL>
<HR>

<A NAME="computeCovarianceMatrix(double[][])"><!-- --></A><H3>
computeCovarianceMatrix</H3>
<PRE>
protected <A HREF="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</A> <B>computeCovarianceMatrix</B>(double[][]&nbsp;data)
                                      throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A>,
                                             <A HREF="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</A></PRE>
<DL>
<DD>Create a covariance matrix from a rectangular array whose columns represent
 covariates. Covariances are computed using the bias-corrected formula.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - input array (must have at least one column and two rows)
<DT><B>Returns:</B><DD>covariance matrix
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the data array does not contain sufficient data
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</A></CODE> - if the input data array is not
 rectangular with at least one row and one column.<DT><B>See Also:</B><DD><A HREF="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html#Covariance(org.apache.commons.math3.linear.RealMatrix)"><CODE>Covariance(org.apache.commons.math3.linear.RealMatrix)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="covariance(double[], double[], boolean)"><!-- --></A><H3>
covariance</H3>
<PRE>
public double <B>covariance</B>(double[]&nbsp;xArray,
                         double[]&nbsp;yArray,
                         boolean&nbsp;biasCorrected)
                  throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></PRE>
<DL>
<DD>Computes the covariance between the two arrays.

 <p>Array lengths must match and the common length must be at least 2.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>xArray</CODE> - first data array<DD><CODE>yArray</CODE> - second data array<DD><CODE>biasCorrected</CODE> - if true, returned value will be bias-corrected
<DT><B>Returns:</B><DD>returns the covariance for the two arrays
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the arrays lengths do not match or
 there is insufficient data</DL>
</DD>
</DL>
<HR>

<A NAME="covariance(double[], double[])"><!-- --></A><H3>
covariance</H3>
<PRE>
public double <B>covariance</B>(double[]&nbsp;xArray,
                         double[]&nbsp;yArray)
                  throws <A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></PRE>
<DL>
<DD>Computes the covariance between the two arrays, using the bias-corrected
 formula.

 <p>Array lengths must match and the common length must be at least 2.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>xArray</CODE> - first data array<DD><CODE>yArray</CODE> - second data array
<DT><B>Returns:</B><DD>returns the covariance for the two arrays
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</A></CODE> - if the arrays lengths do not match or
 there is insufficient data</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Covariance.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html" title="class in org.apache.commons.math3.stat.correlation"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../../index.html?org/apache/commons/math3/stat/correlation/Covariance.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Covariance.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
Copyright &#169; 2003-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>
